import QtQuick
import QtQuick.Controls
import QtQuick.Layouts

Item {
    id: materialListWindowBack
    width: 1770
    height: 1010

    Rectangle{
        anchors.fill: parent
        gradient: Gradient{

            orientation: Gradient.Vertical
            GradientStop { position: 0.0 ; color: "#FFFFFF"}
            GradientStop { position: 0.5 ; color: "#1E90FF"}
            GradientStop { position: 1.0 ; color: "#FFFFFF"}
        }
    }

    Component.onCompleted: {
        currentPage = 1
        materialListLoader.source = "Local_Material_List_ListWindow.qml"
    }

    property real button_Width: 180
    property real button_Height: 60
    property real buttonFontPixle: 20
    property int  currentPage

    Row{
        anchors.left: materialListWindowBack.left
        anchors.leftMargin: 5
        anchors.top: materialListWindowBack.top
        anchors.topMargin: 5
        spacing: 5

        A_Button{
            buttonWidth: button_Width
            buttonHeight: button_Height
            contentText_Data: qsTr("本地料单")
            isSelected: currentPage === 1

            onButtonClicked: {
                currentPage = 1
                materialListLoader.source = "Local_Material_List_ListWindow.qml"
            }

        }
        A_Button{
            buttonWidth: button_Width
            buttonHeight: button_Height
            contentText_Data: qsTr("二维码料单")
            isSelected: currentPage === 2

            onButtonClicked: {
                currentPage = 2
                materialListLoader.source = "QR_Code_List_ListWindow.qml"
            }

        }
        A_Button{
            buttonWidth: button_Width
            buttonHeight: button_Height
            contentText_Data: qsTr("网络料单")
            isSelected: currentPage === 3

            onButtonClicked: {
                currentPage = 3
                materialListLoader.source = "Online_Material_List_ListWindow.qml"
            }

        }
        A_Button{
            buttonWidth: button_Width
            buttonHeight: button_Height
            contentText_Data: qsTr("U盘料单")
            isSelected: currentPage === 4

            onButtonClicked: {
                currentPage = 4
                materialListLoader.source = "U_Disk_Material_List_ListWindow.qml"
            }

        }

    }

    Loader{         // 料单界面加载
        id: materialListLoader
        anchors.top: materialListWindowBack.top
        anchors.topMargin: 70
        anchors.horizontalCenter: materialListWindowBack.horizontalCenter

        onSourceChanged: {
            console.log("当前料单界面为: " + source)
        }
    }


}
